package com.serviceImpl;

import com.javabean.Product;
import com.mapper.ProductMapper;
import com.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;

    @Override
    public List<Product> findAll() {
        return productMapper.selectAll();
    }

    @Override
    public List<Product> findProductName(String name) {
        return productMapper.selectLikeProductName(name);
    }

    @Override
    public Product findById(int id) {
        return productMapper.selectById(id);
    }

    @Override
    public void edit(Product product) {
        productMapper.updateProduct(product);
    }

    @Override
    public void add(Product product) {
        productMapper.insertProduct(product);
    }

    @Override
    public void deleteById(int id) {
        productMapper.deleteById(id);
    }

    @Override
    public void deleteIds(List<Integer> ids) {
        productMapper.deleteByList(ids);
    }
}
